namespace LeonardoNews.Data.Migrations
{
    using LeonardoNews.Models;
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;

    public sealed class Configuration : DbMigrationsConfiguration<LeonardoNews.Data.NewsContext>
    {
        public Configuration()
        {
            this.AutomaticMigrationsEnabled = true;
            this.AutomaticMigrationDataLossAllowed = true;
        }

        protected override void Seed(LeonardoNews.Data.NewsContext context)
        {
            //  This method will be called after migrating to the latest version.

            //  You can use the DbSet<T>.AddOrUpdate() helper extension method 
            //  to avoid creating duplicate seed data. E.g.
            //
            //    context.People.AddOrUpdate(
            //      p => p.FullName,
            //      new Person { FullName = "Andrew Peters" },
            //      new Person { FullName = "Brice Lambson" },
            //      new Person { FullName = "Rowan Miller" }
            //    );
            //

            //var newUser = new User { Username = "Pesho", AuthKey = "1235", SessionKey = "67890" };
            //context.Users.AddOrUpdate(newUser);

            //var newArticle = new Article { User = newUser, Title = "First Article", Text = "Joro is the rabbit", ImageUrl = @"http://fc01.deviantart.net/fs29/i/2008/093/8/8/7_by_Natsia.jpg" };
            //context.Articles.AddOrUpdate(newArticle);

            //var newComment = new Comment { User = newUser, Article = newArticle, Text = "First Comment", ParentComment = null };
            //context.Comments.AddOrUpdate(newComment);

            //var secondComment = new Comment { User = newUser, Article = newArticle, Text = "Second Comment", ParentComment = newComment };
            //context.Comments.AddOrUpdate(secondComment);

            //var newVote = new Vote { User = newUser, Article = newArticle, State = true };
            //context.Votes.AddOrUpdate(newVote);
        }
    }
}
